<template>
  <div>
    <el-form
      ref="formDataRef"
      :model="formData"
      :label-position="labelPosition"
      label-width="100px"
    >
      <!-- <more-panel @queryMethods="queryMethods" @emptyData="emptyData"> -->
      <more-panel mode="1" title="查询条件">
        <el-row :gutter="10" slot="fixed">
          <el-col :span="5">
            <div class="grid-content bg-purple">
              <el-form-item label="客户名称" label-width="70px">
                <el-input
                  placeholder="请输入内容"
                  v-model="formData.custName"
                  class="input-with-select"
                >
                  <el-select
                    v-model="formData.custNameType"
                    slot="append"
                    placeholder="请选择"
                    class="select-box"
                    @change="custNameChange"
                  >
                    <el-option label="精确" value="1"></el-option>
                    <el-option label="模糊" value="2"></el-option>
                  </el-select>
                </el-input>
              </el-form-item>
            </div>
          </el-col>
          <el-col :span="5">
            <div class="grid-content bg-purple">
              <el-form-item
                label="客户编码"
                class="u-ipt"
                prop="oldPartyCode"
                label-width="70px"
              >
                <el-input
                  placeholder="请输入内容"
                  v-model="formData.oldPartyCode"
                  class="input-with-select"
                >
                  <el-select
                    v-model="formData.oldPartyCodeType"
                    slot="append"
                    placeholder="请选择"
                    class="select-box"
                    @change="oldPartyCodeTypeChange"
                  >
                    <el-option
                      v-for="item in custCodeQueryType"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    >
                    </el-option>
                  </el-select>
                </el-input>
              </el-form-item>
            </div>
          </el-col>
          <el-col :span="6"
            ><div class="grid-content bg-purple">
              <el-form-item label="营销责任地">
                <dic-customer-select
                  :value="formData.commonRegionName"
                  title="营销责任地"
                  ref="commonRegionNameRef"
                  size="50%"
                  @inLoadAjax="commonRegionHandel"
                >
                  <!-- 表单 -->
                  <el-form
                    :inline="false"
                    label-width="80px"
                    :model="commonRegionNameForm"
                    ref="commonRegionNameFormRef"
                  >
                    <el-row :gutter="10">
                      <el-col :span="10">
                        <div class="grid-content bg-purple">
                          <el-form-item label="地区标识" class="u-ipt">
                            <el-input
                              placeholder=""
                              v-model="commonRegionNameForm.identityRegion"
                              class="input-with-select"
                              clearable
                            >
                            </el-input>
                          </el-form-item>
                        </div>
                      </el-col>
                      <el-col :span="10">
                        <div class="grid-content bg-purple">
                          <el-form-item label="地区名称" class="u-ipt">
                            <el-input
                              placeholder="请输入内容"
                              v-model="commonRegionNameForm.regionName"
                              class="input-with-select"
                            >
                            </el-input>
                          </el-form-item>
                        </div>
                      </el-col>
                      <el-col :span="4">
                        <el-button
                          type="primary"
                          size="small"
                          @click="commonRegionQuery"
                          >查询</el-button
                        >
                      </el-col>
                    </el-row>
                  </el-form>

                  <DicTable
                    ref="commonRegionTable"
                    stripe
                    max-height="500"
                    highlight-current-row
                    :columnData="commonRegionNameColumns"
                    :tableData="commonRegionNameTableData"
                    :loading="commonRegionNameTableLoading"
                    :currentPage="commonRegionNameTablePage.pageIndex"
                    :pageSize="commonRegionNameTablePage.pageSize"
                    :pager="true"
                    :totalResult="commonRegionNameTablePage.rowCount"
                    @current-change="commonRegionNameCurrentChangeEvent"
                    @on-page-change="commonRegionNameHandlePageChange"
                  >
                  </DicTable>
                </dic-customer-select>
              </el-form-item></div
          ></el-col>
          <el-col :span="5"
            ><div class="grid-content bg-purple">
              <el-form-item
                label="行业类型"
                prop="industryName"
                label-width="70px"
              >
                <dic-customer-select
                  :value="formData.industryName"
                  title="请选择行业类型"
                  ref="industyRef"
                  size="50%"
                  @inLoadAjax="industryCdAjax"
                >
                  <input v-model="filterName" class="searchType" placeholder="搜索" @keyup="searchEvent">
                  <div class="m-tree-box">
                    <vxe-grid
                      border
                      size="medium"
                      max-height="500"
                      :tree-config="custListindustryTableTreeConfig"
                      resizable
                      ref="xTree"
                      :data="custListindustryTableData"
                      :columns="custListindustryTableColumn"
                      @cell-dblclick="custListCellDBLClickEvent"
                    >
                    </vxe-grid>
                  </div>
                </dic-customer-select>
              </el-form-item></div
          ></el-col>
          <el-col :span="3">
            <el-button type="primary" @click="queryMethods">查询</el-button>
            <el-button type="primary" @click="emptyData">重置</el-button>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="5"
            ><div class="grid-content bg-purple">
              <el-form-item
                label="直管类型"
                prop="controlType"
                label-width="70px"
              >
                <el-select
                  v-model="formData.controlType"
                  @change="controlTypeChange"
                >
                  <el-option
                    v-for="item in selectInfo[0].val"
                    :key="item.code"
                    :label="item.name"
                    :value="item.code"
                  >
                  </el-option>
                </el-select>
              </el-form-item></div
          ></el-col>
          <el-col :span="5"
            ><div class="grid-content bg-purple">
              <el-form-item
                label="客户经理"
                prop="custManager"
                label-width="70px"
              >
                <dic-customer-select
                  :value="formData.custManager"
                  title="选择客户经理A"
                  size="50%"
                  ref="custManagerRef"
                  @inLoadAjax="custManagerHandel"
                >
                  <!-- 表单 -->
                  <el-form
                    :inline="false"
                    label-width="80px"
                    :model="custManagerForm"
                    ref="custManagerFormRef"
                  >
                    <el-row :gutter="10">
                      <el-col :span="8">
                        <div class="grid-content bg-purple">
                          <el-form-item
                            label="员工编码"
                            class="u-ipt"
                            prop="STAFF_CODE"
                          >
                            <el-input
                              placeholder=""
                              v-model="custManagerForm.STAFF_CODE"
                              class="input-with-select"
                            >
                            </el-input>
                          </el-form-item>
                        </div>
                      </el-col>
                      <el-col :span="8">
                        <div class="grid-content bg-purple">
                          <el-form-item
                            label="员工名称"
                            class="u-ipt"
                            prop="STAFF_NAME"
                          >
                            <el-input
                              placeholder="请输入内容"
                              v-model="custManagerForm.STAFF_NAME"
                              class="input-with-select"
                            >
                            </el-input>
                          </el-form-item>
                        </div>
                      </el-col>
                      <el-col :span="8">
                        <div class="grid-content bg-purple">
                          <el-form-item
                            label="组织名称"
                            class="u-ipt"
                            prop="ORG_NAME"
                          >
                            <el-input
                              placeholder="请输入内容"
                              v-model="custManagerForm.ORG_NAME"
                              class="input-with-select"
                            >
                            </el-input>
                          </el-form-item>
                        </div>
                      </el-col>
                      <el-col :span="8">
                        <div class="grid-content bg-purple">
                          <el-form-item
                            label="手机号码"
                            class="u-ipt"
                            prop="telNumber"
                          >
                            <el-input
                              placeholder="请输入内容"
                              v-model="custManagerForm.telNumber"
                              class="input-with-select"
                            >
                            </el-input>
                          </el-form-item>
                        </div>
                      </el-col>
                      <el-col :span="8">
                        <el-button
                          type="primary"
                          size="small"
                          @click="queryCustManagerId"
                          >查询</el-button
                        >
                      </el-col>
                    </el-row>
                  </el-form>
                  <!-- 表格 -->
                  <el-table
                    :data="custManagerTable"
                    border
                    stripe
                    max-height="500"
                    @row-click="custManagerDialogRow"
                    class="commonRegionName-table"
                  >
                    <el-table-column property="STAFF_CODE" label="员工编码">
                    </el-table-column>
                    <el-table-column property="STAFF_NAME" label="员工名称">
                    </el-table-column>
                    <el-table-column property="ORG_NAME" label="组织名称">
                    </el-table-column>
                    <el-table-column
                      property="DEPARTMENT_NAME"
                      label="部门名称"
                    >
                    </el-table-column>
                    <el-table-column
                      property="MOBILE_PHONE"
                      label="移动电话"
                    >
                    </el-table-column>
                  </el-table>
                  <el-pagination
                    background
                    @size-change="custManagerHandleSizeChange"
                    @current-change="custManagerHandleCurrentChange"
                    :current-page="querycustManagerDialog.pageIndex"
                    :page-sizes="[5, 10, 15, 20]"
                    :page-size="parseInt(querycustManagerDialog)"
                    layout="total, sizes, prev, pager, next, jumper"
                    :total="parseInt(querycustManagerDialog.rowCount)"
                    class="m-pagination"
                  >
                  </el-pagination>
                </dic-customer-select>
              </el-form-item></div
          ></el-col>

          <el-col :span="6"
            ><div class="grid-content bg-purple">
              <el-form-item label="客户状态">
                <el-select
                  @change="custStatusChange"
                  v-model="formData.custStatusCd"
                  placeholder="请选择"
                >
                  <el-option
                    v-for="item in formData.custStatus"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-form-item></div
          ></el-col>
          <el-col :span="5"
            ><div class="grid-content bg-purple">
              <el-form-item label="是否合规" prop="custReal" label-width="70px">
                <el-select v-model="formData.custReal" placeholder="请选择">
                  <el-option
                    v-for="item in formData.custRealArr"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-form-item></div
          ></el-col>
        </el-row>
        <el-row style="display: none">
          <el-col :span="6"
            ><div class="grid-content bg-purple">
              <el-form-item label="客户名称与身份证是否一致">
                <el-radio-group
                  v-model="formData.isCardConsistent"
                  class="radio-mt"
                >
                  <el-radio :label="1">是</el-radio>
                  <el-radio :label="2">否</el-radio>
                </el-radio-group>
              </el-form-item>
            </div></el-col
          >
        </el-row>
      </more-panel>
    </el-form>
    <div class="m-table-box">
      <DicTable
        ref="myCustTableRef"
        class="m-table"
        align="center"
        border="full"
        max-height="350"
        stripe
        :columnData="tableColumns"
        :tableData="tableData"
        :loading="tableLoading"
        :currentPage="query.pageIndex"
        :pageSize="query.pageSize"
        :totalResult="query.rowCount"
        :pager="true"
        @on-page-change="handlePageChange"
      >
        <template #custName="{ row }">
          <i
            v-if="!row.identityType || row.identityType == ''"
            class="sfz whg"
          ></i>
          <i v-else-if="row.identityType == '1'" class="sfz dsh"></i>
          <i v-else class="sfz yhg"></i>
          <span>{{ row.custName }}</span>
        </template>
        <template #partyNbr="{ row }">
          <text-dialog-model
            :text="row.partyNbr"
            type="1"
            color="blue"
            title="证件详情"
            size="85%"
            btnShow="1"
            @showDialog="cardDetailHandel(row)"
          >
            <el-row class="el-row" :gutter="6">
              <el-col :span="4">
                <div class="grid-content bg-purple">
                  <div class="demo-image__placeholder">
                    <!-- <div class="block">
                      <el-image
                        :src="src"
                        class="u-image"
                        fit="cover"
                        :preview-src-list="srcList"
                        :z-index="3000"
                      ></el-image>

                    </div> -->
                     <div class="block" style="text-align:center;">
                        <el-image v-if="!src" fit="scale-down" :src="require('@/assets/imgs/wjz.jpg')" :preview-src-list="[require('@/assets/imgs/wjz.jpg')]" :z-index="3000"  class="img">                                                 
                        </el-image>
                        <el-image v-else fit="scale-down" :src="src" :preview-src-list="srcList" :z-index="3000"  class="img">                                                
                        </el-image>
                      </div>
                  </div></div
              ></el-col>
              <el-col :span="20"
                ><div class="grid-content bg-purple m-cust-info">
                  <div>
                    <h3 class="u-info-title">
                      {{ name }}
                    </h3>
                    <el-row :gutter="6">
                      <el-col
                        :span="8"
                        v-for="(item, index) in dataArr[0]"
                        :key="index"
                        class="flexCol"
                      >
                        <el-col :span="10" class="u-name"
                          >{{ item.name }}：</el-col
                        >
                        <el-col :span="14" class="u-value"
                          >{{ item.value }}

                          <span
                            v-if="item.flag != 0 && item.sysUser && item.value != ''"
                            class="u-btn"
                          >
                            <template>
                              <el-button
                                type="text"
                                @click="partyNumberInfoToView(item.flag, index)"
                                size="mini"
                                class="u-toView-btn"
                              >
                                查看
                              </el-button>
                            </template>
                          </span>
                        </el-col>
                      </el-col>
                      <el-col :span="20" style="min-height:35px;margin-top:5px">
                        <el-col :span="4" class="u-name"
                          >注册地址：
                        </el-col>
                        <el-col :span="20" class="u-value">
                          {{ dataArr[1][0].value }}
                        </el-col>
                      </el-col>
                      <el-col :span="20">
                        <el-col :span="4" class="u-name"
                          >经营范围：
                        </el-col>
                        <el-col :span="20" class="u-value">
                          {{ dataArr[2][0].value }}
                        </el-col>
                      </el-col>
                    </el-row>
                  </div>
                </div></el-col
              >
            </el-row>
          </text-dialog-model>
        </template>
        <template #statusCd="{ row }">
          <div v-if="row.statusCd == '1000' && row.auditStatusCd == '1110'">
            未生效-未送审
          </div>
          <div v-if="row.statusCd == '1000' && row.auditStatusCd == undefined">
            未生效-未送审
          </div>
          <div v-if="row.statusCd == '1000' && row.auditStatusCd == '1120'">
            未生效-审核中
          </div>
          <div v-if="row.statusCd == '1000' && row.auditStatusCd == '1130'">
            未生效-审核不通过
          </div>
          <div v-if="row.statusCd == '1100'">有效</div>
          <div v-if="row.statusCd == '1300'">无效</div>
        </template>
        <template #opt1="{ row }">
          <el-popover trigger="hover" placement="bottom">
            <el-row>
              <el-col :span="24">
                <router-link
                  :to="{
                    path: '/custView',
                    query: {
                      partyId: row.partyId,
                      staffId: user.staffId,
                      custId: row.custId,
                    },
                  }"
                  tag="a"
                  ><span class="u-point"></span>客户视图</router-link
                >
              </el-col>
              <el-col :span="24">
                <dic-customer-btn-drawer
                  title="客户审核历史"
                  ref=""
                  :isShow.sync="custAuditHistoryIsShow"
                  size="70%"
                  btnShow="false"
                >
                  <span
                    slot="btnSlot"
                    class="u-tabgs-btn"
                    @click="custAuditHistoryHandel(row)"
                    ><span class="u-point"></span>客户审核历史</span
                  >
                  <div>
                    <!-- 客户审核历史表格list start -->
                    <DicTable
                      ref="dictable"
                      stripe
                      max-height="400"
                      :columnData="customerAuditRecordColumns"
                      :tableData="customerAuditRecordData"
                      :loading="customerAuditLoading"
                      :currentPage="customerAuditTablePage.pageIndex"
                      :pageSize="customerAuditTablePage.pageSize"
                      :pager="true"
                      :totalResult="customerAuditTablePage.rowCount"
                      @on-page-change="customerAuditHandlePageChange"
                      align="center"
                    >
                    </DicTable>
                    <!-- 客户审核历史表格list end-->
                  </div>
                </dic-customer-btn-drawer>
              </el-col>
              <el-col :span="24">
                <!--  操作日志start-->
                <dic-customer-btn-drawer
                  title="操作日志"
                  ref=""
                  size="70%"
                  :isShow.sync="opretionIsShow"
                  btnShow="false"
                >
                  <span
                    slot="btnSlot"
                    class="u-tabgs-btn"
                    @click="operationLogHandel(row)"
                    ><span class="u-point"></span>操作日志</span
                  >
                  <div>
                    <!-- 操作日志表格list start -->
                    <DicTable
                      ref="operationLogTable"
                      stripe
                      max-height="350"
                      :columnData="operationLogColumns"
                      :tableData="operationLogData"
                      :loading="operationLogLoading"
                      :currentPage="operationLogTablePage.pageIndex"
                      :pageSize="operationLogTablePage.pageSize"
                      :pager="true"
                      :totalResult="operationLogTablePage.rowCount"
                      @on-page-change="operationLogHandlePageChange"
                    >
                      <template #opt="{ row }">
                        <el-button
                          type="text"
                          v-if="
                            row.operationCd == 'editNews' ||
                            row.operationCd == 'edit' ||
                            row.operationCd == 'editName_s'
                              ? true
                              : false
                          "
                          @click="detailDialog(row)"
                          >明细</el-button
                        >
                      </template>
                    </DicTable>
                    <!-- 操作日志表格list end-->
                  </div>
                  <el-dialog
                    width="60%"
                    title="修改明细"
                    :visible.sync="innerVisible"
                    append-to-body
                  >
                    <el-table
                      ref="detailData"
                      :data="
                        detailData.slice(
                          (dtablePage.pageIndex - 1) * dtablePage.pageSize,
                          dtablePage.pageIndex * dtablePage.pageSize
                        )
                      "
                      border
                      :header-cell-style="{
                        background: '#F2F2F2',
                        color: '#333',
                      }"
                      tooltip-effect="dark"
                      style="width: 100%"
                    >
                      <el-table-column label="序号" width="50" align="center">
                        <template scope="scope">
                          <span>{{scope.$index + (dtablePage.pageIndex - 1) * dtablePage.pageSize + 1}} </span>   
                        </template>
                      </el-table-column>
                      <el-table-column
                        label="属性名称"
                        prop="NAME"
                        align="center"
                        show-overflow-tooltip
                      >
                      </el-table-column>
                      <el-table-column
                        prop="NEW_VALUE"
                        label="新属性值"
                        align="center"
                        show-overflow-tooltip
                      >
                      </el-table-column>
                      <el-table-column
                        prop="OLD_VALUE"
                        label="原属性值"
                        align="center"
                        show-overflow-tooltip
                      >
                      </el-table-column>
                      <el-table-column
                        prop="TIME"
                        label="修改时间"
                        align="center"
                        show-overflow-tooltip
                      >
                      </el-table-column>
                    </el-table>
                    <el-pagination
                      background
                      @current-change="pageChange"
                      :current-page="parseInt(dtablePage.pageIndex)"
                      :page-size="parseInt(dtablePage.pageSize)"
                      layout="total, prev, pager, next, jumper"
                      :total="parseInt(detailData.length)"
                      class="m-pagination"
                    >
                    </el-pagination>
                  </el-dialog>
                </dic-customer-btn-drawer>
              </el-col>
            </el-row>

            <span slot="reference" class="name-wrapper">
              <el-button type="text">查看</el-button>
            </span>
          </el-popover>
          <el-popover trigger="hover" placement="bottom" width="400">
            <el-row class="m-row">
              <el-col :span="12">
                <div
                  class="u-tabgs-btn"
                  @click="changeNameHandel(row, 'changeName')"
                >
                  <span class="u-point"></span>改名改证件
                </div>
              </el-col>
              <el-col :span="12">
                <div
                  class="u-tabgs-btn"
                  @click="changeNameHandel(row, 'compliance')"
                >
                  <span class="u-point"></span>合规性认证
                </div>
              </el-col>
              <el-col :span="12" class="u-tabgs-btn">
                <span
                  @click="
                    pathToView(
                      row,
                      '/modifyBasicInfo',
                      (queryParams = {
                        partyId: row.partyId,
                        staffId: user.staffId,
                        custId: row.custId,
                      })
                    )
                  "
                  ><span class="u-point"></span>修改客户基本信息</span
                >
              </el-col>
              <el-col :span="12" class="u-tabgs-btn">
                <span
                  @click="
                    pathToView(
                      row,
                      '/NewKeyPerson',
                      (queryParams = {
                        partyId: row.partyId,
                        staffId: user.staffId,
                        custId: row.custId,
                      })
                    )
                  "
                  ><span class="u-point"></span>新建关键人信息</span
                >
              </el-col>
              <el-col :span="12" class="u-tabgs-btn">
                <span
                  class="u-tabgs-btn"
                  @click="
                    pathToView(
                      row,
                      '/CustRelationMaintain',
                      (queryParams = {
                        staffId: user.staffId,
                        custId: row.custId,
                        oldPartyCode: row.oldPartyCode,
                        partyNbr: row.partyNbr,
                      })
                    )
                  "
                  ><span class="u-point"></span>省客户关系维护</span
                >
              </el-col>
              <el-col :span="12" class="u-tabgs-btn">
                <span
                  @click="
                    pathToView(
                      row,
                      '/custContactInfo',
                      (queryParams = {
                        partyId: row.partyId,
                        locationId: row.locationId,
                        staffId: user.staffId,
                        custId: row.custId,
                      })
                    )
                  "
                  tag="span"
                  class="u-tabgs-btn"
                  ><span class="u-point"></span>客户联系人信息</span
                >
              </el-col>
              <!-- v-if="row.statusCd == '1000' && row.auditStatusCd == '1110' ? true:false" -->
              <el-col :span="12" class="u-tabgs-btn" v-if="row.statusCd == '1100'? false : true">
                <div class="u-tabgs-btn" @click="sendAuditHandel(row)">
                  <span class="u-point"></span>送审核
                </div>
              </el-col>
              <el-col
                :span="12"
                class="u-tabgs-btn"
                v-if="row.statusCd == '1100'? false : true"
              >
                <span class="u-tabgs-btn" @click="delateCusthandel(row)"
                  ><span class="u-point"></span>删除客户</span
                >
              </el-col>

              <el-col :span="12" class="u-tabgs-btn">
                <span
                  @click="
                    pathToView(
                      row,
                      '/custCutoverInfo',
                      (queryParams = {
                        custId: row.custId,
                        partyId: row.partyId,
                        staffId: user.staffId,
                      })
                    )
                  "
                  tag="span"
                  class="u-tabgs-btn"
                  ><span class="u-point"></span>客户割接通知信息
                </span>
              </el-col>
              <!-- 上传附件 -->
              <el-col :span="12" class="u-tabgs-btn">
                <dic-customer-btn-drawer
                  ref="toUploadAttachmentRef"
                  title="上传附件"
                  size="40%"
                  btnShow="false"
                  :isShow.sync="toUploadAttachmentIsShow"
                  @drawShow="toUploadAttachmentsHandel(row)"
                  @closeDrawer="toUploadAttachmentSubmitChangeForm(row)"
                >
                  <span slot="btnSlot" class="u-tabgs-btn"
                    ><span class="u-point"></span>上传附件</span
                  >
                  <DicTable
                    ref="toUploaddictable"
                    max-height="300"
                    stripe
                    :columnData="toUploadTableColumns"
                    :tableData="toUploadTableData"
                    :loading="toUploadTableLoading"
                    :currentPage="toUploadTablePage.pageIndex"
                    :pageSize="toUploadTablePage.pageSize"
                    :totalResult="toUploadTablePage.rowCount"
                    :pager="true"
                    @on-page-change="toUploadhandlePageChange"
                  >
                    <template #opration="{ row }">
                      <el-button
                        type="text"
                        class="opt-btn"
                        @click="downloadHandel(row)"
                        >下载</el-button
                      >
                      <el-button
                        type="text"
                        class="opt-btn"
                        @click="delateHandel(row)"
                        >删除</el-button
                      >
                    </template>
                    <template #createDate="{ row }">
                      <span>{{
                        row.createDate.substring(0, 4) +
                        "-" +
                        row.createDate.substring(4, 6) +
                        "-" +
                        row.createDate.substring(6, 8) +
                        "  " +
                        row.createDate.substring(8, 10) +
                        ":" +
                        row.createDate.substring(10, 12) +
                        ":" +
                        row.createDate.substring(12, 14)
                      }}</span>
                    </template>
                  </DicTable>

                  <el-row>
                    <el-col :span="24">
                      <el-form ref="toUploadFormRef" label-width="100px">
                        <el-form-item label="上传附件">
                          <el-upload
                            class="upload-demo"
                            ref="custuploadRef"
                            action="#"
                            :on-change="custListonChange"
                            :on-remove="custListHandleRemove"
                            :on-exceed="custListHandleExceed"
                            :limit="1"
                            :http-request="custListUploadHttp"
                            :file-list="custListfileList"
                            :before-upload="custListfileBeforeAvatarUpload"
                            :auto-upload="false"
                          >
                            <el-button
                              slot="trigger"
                              size="small"
                              type="primary"
                              >选取文件</el-button
                            >
                            <el-button
                              style="margin-left: 10px"
                              size="small"
                              type="success"
                              @click="custListSubmitUpload()"
                              >上传到服务器</el-button
                            >
                          </el-upload>
                        </el-form-item>
                      </el-form>
                    </el-col>
                  </el-row>
                  <el-row class="box-center">
                    <el-col :span="24">
                      <el-button
                        type="primary"
                        @click="toUploadAttachmentSubmitChangeForm(row)"
                        >关闭</el-button
                      >
                    </el-col>
                  </el-row>
                </dic-customer-btn-drawer>
              </el-col>
              <el-col :span="12" class="u-tabgs-btn">
                <dic-customer-btn-drawer
                  title="客户证件照补传"
                  size="60%"
                  btnShow="false"
                  :isShow.sync="copyIdPhotoIsShow"
                  @drawShow="copyIdPhotosHandel(row)"
                  @closeDrawer="copyIdPhotoSubmitChangeForm(row)"
                >
                  <span slot="btnSlot" class="u-tabgs-btn"
                    ><span class="u-point"></span>客户证件照补传</span
                  >

                  <el-row>
                    <el-form
                      ref="copyIdPhotoRef"
                      :model="copyIdPhoto"
                      label-width="80px"
                    >
                      <el-col :span="8">
                        <el-form-item label="客户名称" prop="partyName">
                          <el-input
                            v-model="copyIdPhoto.partyName"
                            :disabled="true"
                          ></el-input>
                        </el-form-item>
                      </el-col>
                      <el-col :span="8">
                        <el-form-item label="证件类型" prop="certTypeName">
                          <el-input
                            v-model="copyIdPhoto.certTypeName"
                            :disabled="true"
                          ></el-input>
                        </el-form-item>
                      </el-col>
                      <el-col :span="8">
                        <el-form-item label="证件号码" prop="certNum">
                          <el-input
                            placeholder="请输入内容"
                            v-model="copyIdPhoto.certNum"
                            :disabled="true"
                          >
                          </el-input>
                        </el-form-item>
                      </el-col>
                      <el-col :span="24">
                        <el-form-item label="证件地址" prop="certAddr">
                          <el-input
                            placeholder="请输入内容"
                            v-model="copyIdPhoto.certAddr"
                            :disabled="true"
                          >
                          </el-input>
                        </el-form-item>
                      </el-col>
                      <el-col :span="16">
                        <el-form-item label="证件复印件照片">
                          <el-upload
                            :action="uploadUrl"
                            list-type="picture-card"
                            :show-file-list="true"
                            :file-list="copyIdPhotoList"
                            :multiple="false"
                            :data="copyIdPhotoHandleAvatarData"
                            accept=".jpg,.png"
                            :on-change="copyIdPhotoHandleAvatarChange"
                            :on-preview="copyIdPhotoHandleAvatarPreview"
                            :on-success="copyIdPhotoHandleAvatarSuccess"
                            :before-upload="copyIdPhotoeforeAvatarUpload"
                          >
                            <div slot="tip" class="el-upload__tip">
                              只能上传jpg/png文件，且不超过10M
                            </div>
                            <i class="el-icon-plus"></i>
                          </el-upload>

                          <el-dialog
                            :visible.sync="copyIdPhotoeforeAvatarDialogVisible"
                            append-to-body
                          >
                            <img
                              width="100%"
                              :src="copyIdPhotoeforeAvatarDialogImageUrl"
                              alt=""
                            />
                          </el-dialog>
                        </el-form-item>
                      </el-col>
                    </el-form>
                  </el-row>
                </dic-customer-btn-drawer>
              </el-col>
            </el-row>
            <span slot="reference" class="name-wrapper">
              <el-button type="text">编辑</el-button>
            </span>
          </el-popover>
        </template>
      </DicTable>
      <ul v-if="true" class="exp flex">
        <li><i class="sfz yhg mtop"></i>已合规-正式身份证</li>
        <li><i class="sfz dsh mtop"></i>已合规-临时身份证</li>
        <li><i class="sfz whg mtop"></i>未合规</li>
      </ul>
    </div>
    <el-dialog
      :title="changeNameTitle"
      append-to-body
      :visible.sync="isShow"
      v-if="isShow"
      :isShow.sync="isShow"
      :close-on-click-modal="false"
      width="40%"
    >
      <component
        v-bind:is="whichComp"
        :data="changeNameForm"
        @subitForm="subitForm"
        @cancelHandel="cancelHandel"
      ></component>
    </el-dialog>
    <el-dialog
      title="客户送审核"
      append-to-body
      width="40%"
      :visible.sync="customerReviewIsShow"
    >
      <auditorDialog
        v-if="auditIdComponentsIsShow"
        @sunmitAuditIdHandel="sunmitAuditIdHandel"
      ></auditorDialog>
    </el-dialog>
  </div>
</template>
<script>
import MorePanel from "@/components/public/MorePanel/index";
import DicCustomerSelect from "@/components/customer/form/DicCustomerSelect";
import DicTable from "@/components/public/DicTable";
import DicCustomerBtnDrawer from "@/components/customer/form/DicCustomerBtnDrawer";
import ChangeName from "@/views/customer/customer-dialog/ChangeName";
import NewKeyPerson from "@/views/customer/customer-dialog/NewKeyPerson";
import CustomerInfoManageServer from "@/api/customer/CustomerInfoManageServer";
import modificationDetails from "@/api/customer/modificationDetails";
import TextDialogModel from "@/components/customer/dialog/TextDialogModel";
import InputDrawer from "@/components/public/forms/InputDrawer";
import inputDialogA from "@/components/public/forms/inputDialoga";
import Compliance from "@/views/customer/customer-dialog/Compliance";
import auditorDialog from "@/views/customer/components/auditorDialog";
import XEUtils from 'xe-utils'

import { mapState } from "vuex";
import validRules from "@/views/customer/valide/gaoyjValidRules.js";

export default {
  name: "MyCustomer",
  props: {
    tableDataList: {
      type: Object,
      default() {
        return {};
      },
    },
  },
  data() {
    return {
      filterName:'',//行业类型搜索input框
      isShow: false,
      complianceIsShow: false,
      customerAuditCiustId: "",
      copyIdPhotoIsShow: false,
      opretionIsShow: false,
      custAuditHistoryIsShow: false,
      customerReviewIsShow: false,
      // 弹窗内-审核人的组件是否显示
      auditIdComponentsIsShow: false,
      // 改名改证件照片数组
      changeNameList: [],
      // 改名改证件权限变量
      changeNameUserInfo: {
        val: "", //已合规
        message: "客户已在审核中，不能进行客户合规性验证操作",
      },
      complianceUserInfo: {
        val: "", //已合规
        message: "客户已在审核中，不能进行客户合规性验证操作",
      },
      changeNameDialogVisible: false,
      // 改名改证件
      changeNamephoData: {
        partyId: "",
        fileFlag: "party",
        oldPhotoPath: "",
      },
      //客户编码-查询类型
      custCodeQueryType: [
        {
          value: "1",
          label: "精确",
        },
        {
          value: "2",
          label: "模糊",
        },
      ],
      // 我的客户表单样式
      formData: {
        // 客户编码
        oldPartyCode: "",
        // 营销责任地id
        regionId: "",
        // 营销责任地名称
        commonRegionName: "",
        // 客户编码-默认展示的值
        oldPartyCodeType: "1",
        //直管类型
        controlType: "",
        // 行业类型
        industryTypeId: "",
        // 行业类型code
        industryName: "",
        // 是否合规
        custReal: "",
        // 客户名称
        custName: "",
        // 客户名称的默认选中的value
        custNameType: "1",
        // 客户经理
        custManagerId: "",
        // 客户经理名称
        custManager: "",
        // 客户状态
        custStatus: [
          {
            value: "",
            label: "请选择",
          },
          {
            value: "1",
            label: "有效",
          },
          {
            value: "2",
            label: "未生效-未送审",
          },
          {
            value: "3",
            label: "未生效-审核中",
          },
          {
            value: "4",
            label: "未生效-审核不通过",
          },
        ],
        // 是否合规
        custRealArr: [
          {
            value: "",
            label: "请选择",
          },
          {
            value: "1",
            label: "是",
          },
          {
            value: "0",
            label: "否",
          },
        ],
        // 客户状态选中的值
        custStatusCd: "",
        // 客户名称与身份证是否一致
        isCardConsistent: "1",
      },
      // 客户列表 tabs切换按钮样式
      tabsData: [
        {
          name: "我的客户",
          icon: "el-icon-edit",
        },
        {
          name: "我管控的客户",
          icon: "el-icon-edit",
        },
        {
          name: "客户查询",
          icon: "el-icon-edit",
        },
      ],
      // form lebel 对齐方式
      labelPosition: "left",
      // 查询后台列表分页参数
      query: {
        pageIndex: 1, //当前页码
        pageSize: 10, //每页多少条
        rowCount: 0, //总条数
        pageCount: 0, //总页数
      },
      // 客户列表 表格
      tableColumns: [
        // { type: "id", width: 50, fixed: null },
        {
          field: "oldPartyCode",
          title: "客户编码",
          width: 200,
          showOverflow: true,
        },
        {
          slotName: "custName",
          title: "客户名称",
          minWidth: 200,
          showOverflow: true,
          // align:left
        },
        {
          slotName: "partyNbr",
          title: "政企客户身份证",
          width: 200,
          showOverflow: true,
        },
        {
          field: "industryTypeName",
          title: "行业类型",
          width: 150,
          showOverflow: true,
        },
        {
          field: "regionName",
          title: "营销责任地",
          width: 200,
          showOverflow: true,
        },
        {
          field: "controlTypeName",
          title: "直管类型",
          width: 100,
          showOverflow: true,
        },
        {
          field: "custManagerName",
          title: "客户经理",
          width: 100,
          showOverflow: true,
        },
        {
          field: "createDate",
          title: "创建时间",
          width: 100,
          showOverflow: true,
        },
        {
          slotName: "statusCd",
          title: "客户状态",
          width: 100,
          showOverflow: true,
        },
        { slotName: "opt1", title: "操作", width: 150, fixed: "right" },
      ],
      // 客户列表-数据
      tableData: [],
      tableLoading: false,
      tablePage: {
        currentPage: 1,
        pageSize: 10,
        totalResult: 0,
      },
      // 营销责任地 表单
      commonRegionNameForm: {
        identityRegion: "", //地区标识
        regionName: "", //地区名称
      },
      //营销责任地弹窗显示隐藏
      commonRegionNameDialogVisible: false,
      // 营销责任地弹窗里分页的参数
      queryCommonRegionIdDialog: {
        pageIndex: 1, //当前页码
        pageSize: 5, //每页多少条
        rowCount: 0, //总条数
        pageCount: 0, //总页数
      },
      //    --------营销责任地 start------------------
      commonRegionNameColumns: [
        // { type: "id", width: 50, fixed: null },
        { field: "COMMON_REGION_ID", title: "地区标识" },
        { field: "REGION_NAME", title: "地区名称" },
      ],
      commonRegionNameTableData: [
        // {
        //   id: 10001,
        //   COMMON_REGION_ID: "2021-03-10",
        //   REGION_NAME: "T1", //争议单编号
        // },
        // {
        //   id: 10002,
        //   COMMON_REGION_ID: "2021-03-10",
        //   REGION_NAME: "T1", //争议单编号
        // },
      ],
      commonRegionNameTableLoading: false,
      // 营销责任地分页
      commonRegionNameTablePage: {
        pageIndex: 1,
        pageSize: 5,
        rowCount: 0,
        pageCount: 0,
      },
      // 客户列表--客户经理弹窗表单
      custManagerForm: {
        STAFF_CODE: "",
        STAFF_NAME: "",
        ORG_NAME: "",
        telNumber: "",
      },
      // 客户列表--客户经理表格数据
      custManagerTable: [],
      // 客户列表--客户经理表格分页
      querycustManagerDialog: {
        pageIndex: 1, //当前页码
        pageSize: 5, //每页多少条
        rowCount: 0, //总条数
        pageCount: 0, //总页数
      },
      //  客户审核记录表头
      customerAuditRecordColumns: [
        { type: "seq", width: 60, title: "序号", fixed: "left" },
        {
          field: "custName",
          title: "客户名称",
          width: 150,
          fixed: "left",
          showOverflow: true,
        },
        {
          field: "custAuditKindName",
          title: "审核类型",
          width: 100,
          fixed: "left",
          showOverflow: true,
        },
        {
          field: "sendAuditByName",
          title: "创建人",
          width: 100,
          showOverflow: true,
        },
        {
          field: "sendAuditByCode",
          title: "创建人账号",
          width: 100,
          showOverflow: true,
        },
        {
          field: "sendAuditByOrgName",
          title: "创建人组织",
          width: 100,
          showOverflow: true,
        },
        {
          field: "auditorName",
          title: "审核人",
          width: 100,
          showOverflow: true,
        },
        {
          field: "auditorCode",
          title: "审核人账号",
          width: 100,
          showOverflow: true,
        },
        {
          field: "auditorOrgName",
          title: "审核人组织",
          width: 100,
          showOverflow: true,
        },
        {
          field: "auditStatus",
          title: "审核结果",
          width: 100,
          showOverflow: true,
        },
        {
          field: "auditIdea",
          title: "审核意见",
          width: 100,
          showOverflow: true,
        },
        {
          field: "statusCdName",
          title: "审核状态",
          width: 100,
          showOverflow: true,
        },
        {
          field: "auditDate",
          title: "审核时间",
          width: 150,
          showOverflow: true,
        },
      ],
      // 客户审核记录列表
      customerAuditRecordData: [],
      // 客户审核历史加载条
      customerAuditLoading: false,
      // 客户审核历史分页
      customerAuditTablePage: {
        pageIndex: 1,
        pageSize: 5,
        rowCount: 0,
        pageCount: 0,
      },
      // 操作日志
      modifyFooterVisibi: true,

      operationLogColumns: [
        { type: "seq", width: 60, title: "序号", fixed: "left" },
        {
          field: "custName",
          title: "客户名称",
          width: 250,
          showOverflow: true,
          fixed: "left",
        },
        {
          field: "remark",
          title: "操作类型",
          showOverflow: true,
          width: 150,
        },
        {
          field: "operationByName",
          title: "操作人",
          showOverflow: true,
          width: 150,
        },
        {
          field: "operationByCode",
          title: "操作人账号",
          width: 250,
          showOverflow: true,
        },
        {
          field: "operationByOrgName",
          title: "操作人组织",
          width: 250,
          showOverflow: true,
        },
        {
          field: "operationDate",
          title: "操作时间",
          width: 150,
          showOverflow: true,
        },
        { slotName: "opt", title: "操作", width: 100, fixed: "right" },
      ],
      // 操作日志用来存custId的变量
      operationLogRowCustId: "",
      // 操作日志列表
      operationLogData: [],
      // 客户审核历史加载条
      operationLogLoading: false,
      // 客户审核历史分页
      operationLogTablePage: {
        pageIndex: 1,
        pageSize: 5,
        rowCount: 0,
        pageCount: 0,
      },

      // 客户列表-选择为未生效-未送审时-审核人研创-表格选中事件
      custListAuditor: "",
      // 修改基本信息弹窗参数
      modifyBasicInfo: {
        type: "1",
      },
      dataArr: [
        [
          { name: "统一社会信用代码", value: "", flag: "1",sysUser:false },
          { name: "证件类型", value: "", flag: "0" },
          { name: "证件号码", value: "", flag: "2",sysUser:false },
          { name: "身份证类型", value: "", flag: "0" },
          { name: "身份证编码", value: "", flag: "0" },
          { name: "身份证有效期", value: "", flag: "0" },
          { name: "客户简称", value: "", flag: "0" },
          { name: "机构类型", value: "", flag: "0" },
          { name: "行业类型", value: "", flag: "0" },

          { name: "登记管理部门名称", value: "", flag: "0" },
          { name: "经济类型", value: "", flag: "0" },
          { name: "法定代表人姓名", value: "", flag: "0" },
          { name: "注册资本", value: "", flag: "0" },
          { name: "成立日期", value: "", flag: "0" },
          { name: "发照日期", value: "", flag: "0" },
          { name: "经营状态", value: "", flag: "0" },
          { name: "发证机关", value: "", flag: "0" },
          { name: "生产经营地址", value: "", flag: "0" },
        ],
        [{ name: "注册地址", value: "", flag: "0" }],
        [{ name: "经营范围", value: "", flag: "0" }],
      ],
      isAuditIdShow: false,

      name: "",
      // 客户详情
      src: "",
      srcList: [],
      changeDataParams: {
        partyId: "",
        custId: "",
      },
      // 改名改证件
      changeNameForm: {
        flag: "",
        custId: "",
        partyId: "",
        statusCd: "", //进入改名改证件 用来判断 审核人是否显示的字段
      },

      changeNameRules: {
        partyName: [
          { required: true, message: "请输入证件名称", trigger: "blur" },
        ],

        certType: [
          {
            required: true,
            validator: validRules.gaoyj_checkIdCardSType,
            message: "请选择证件类型",
            trigger: "change",
          },
        ],
        certNum: [
          {
            validator: validRules.gaoyj_checkIdCardNum,
            trigger: "blur",
          },
        ],
        certAddr: [
          {
            validator: validRules.gaoyj_checkedCustCertAddr,
            trigger: "blur",
          },
        ],
        industryTypeName: [
          { required: true, message: "请选择行业类型", trigger: "blur" },
        ],
        auditor: [
          { required: true, message: "审核人不能为空", trigger: "blur" },
        ],
        photoPath: [
          { validator: validRules.gaoyj_checkedPhotoPath, trigger: "blur" },
        ],
      },
      imageUrl: "",
      // 改名改证件-证件类型是否显示
      industryTypeNameIsShow: false,

      cardTypeArr: [
        { value: "15", label: "组织机构代码证" },
        { value: "34", label: "事业单位法人证书" },
        { value: "43", label: "社会团体法人登记证书" },
        { value: "49", label: "统一社会信用代码证书" },
        { value: "56", label: "律师事务所执业许可证" },
        { value: "57", label: "民办非企业单位登记证书" },
        { value: "58", label: "外国驻华新闻机构证" },
        { value: "59", label: "境外非政府组织代表机构登记证书" },
        { value: "6", label: "营业执照" },
        { value: "60", label: "基金会法人登记证书" },
        {
          value: "61",
          label: "基层群众性自治组织特别法人统一社会信用代码证书",
        },
        { value: "62", label: "业主大会统一社会信用代码证书" },
        { value: "63", label: "外国在华文化中心登记证" },
        { value: "64", label: "港澳台地区旅游部门常驻代表机构批准登记证" },
        { value: "65", label: "外国政府旅游部门常驻代表机构批准登记证" },
        { value: "66", label: "宗教活动场所登记证" },
        { value: "67", label: "宗教院校许可证" },
        {
          value: "68",
          label: "港澳新闻机构常驻内地记者站登记证",
        },
        { value: "69", label: "工会法人资格证书" },
        { value: "7", label: "单位介绍信/公函+公章（仅用于党政军客户）" },
        {
          value: "70",
          label: "中国国际贸易促进委员会行业委员会统一社会信用代码证书",
        },
        { value: "71", label: "中华人民共和国统一社会信用代码证书" },
        { value: "72", label: "境外证件" },
        { value: "73", label: "农村集体经济组织登记证书" },
        { value: "74", label: "外国律师事务所驻华代表处执业许可证" },
        { value: "75", label: "医疗机构执业许可证" },
      ],

      changeNameindustryCdTree: [],
      // 下拉框的取值
      selectInfo: [
        {
          flag: "control_type", //直管类型
          val: [],
        },
        {
          flag: "cert_type", //改名改证件直管类型
          val: [],
        },
      ],

      labelPosition: "left",
      //行业类型
      industryTypeColumns: [
        { type: "seq", width: 60, title: "序号", fixed: "left" },
        { field: "custName", title: "客户名称", width: 100, fixed: "left" },
        { field: "controlLevel", title: "管控级别", width: 100, fixed: "left" },
      ],
      industryTypeTableData: [
        {
          id: 10001,
          keyPersonName: "2021-03-10",
          keyPersonType: "T1",
          birthday: "2021-03-10",
          contactPhone: "联系电话",
          email: "联系电话",
          department: "部门",
          position: "职务",
          decisionMaking: "决策影响力",
        },
      ],
      industryTypeTableLoading: false,
      industryTypeTablePage: {
        pageIndex: 1,
        pageSize: 3,
        totalResult: 0,
      },
      // 客户列表行业类型
      custListindustryTableData: [],
      originData:[],
      custListindustryTableColumn: [
        { field: "industryTypeName", title: "行类类型名称", treeNode: "true" },
      ],
      custListindustryTableTreeConfig: {
        children: "children",
        iconOpen: "el-icon-remove",
        iconClose: "el-icon-circle-plus",
        // accordion: true, // 一层只允许展开一个节点
        expandAll: false, // 默认是否全部展开
      },
      // 上传附件
      toUploadAttachmentIsShow: false,
      // 附件上传表格-表头
      toUploadTableColumns: [
        { type: "seq", width: 60, fixed: null },
        { field: "accName", title: "附件名称", width: 200 },
        {
          slotName: "accTypeName",
          title: "附件类型",
          width: 300,
          showoverflow: true,
        },
        { field: "createByName", title: "上传人", width: 200 },
        { slotName: "createDate", title: "上传时间", width: 200 },
        { slotName: "opration", title: "操作", width: 150 },
      ],
      toUploadTableData: [],
      toUploadTableLoading: false,
      toUploadTablePage: {
        pageIndex: 1,
        pageSize: 5,
        pageCount: 0,
        rowCount: 0,
      },
      // 上传附件表单
      toUploadForm: {},
      uploadUrl: `${process.env.VUE_APP_CTX_CUST}/saveCustFile`,
      // 上传文件列表
      custListfileList: [],
      //
      uploadPartyId: "",
      //客户列表-改名该证件-证件照片上传-放大-弹窗的显示隐藏
      changeNameDialogVisible: false,
      //客户列表-改名该证件-证件照片上传-放大-弹窗内的照片的路径
      changeNameDialogImageUrl: "",

      // 证件照补传-表单
      copyIdPhoto: {
        partyName: "", //客户名称
        certTypeName: "", //证件名称
        certNum: "", //证件号码
        certAddr: "", //证件地址
        photoName: "", //证件照片名称
        photoPath: "", //证件照片路径
      },
      // 送审核表单
      addauditIdForm: {
        name: "", //员工编码
      },
      // 送审核-弹窗-表格内容
      auditIdColumns: [
        {
          field: "jtCustName",
          title: "员工编码",
          fixed: "left",
          showOverflow: true,
          width: 100,
        },
        {
          field: "orgUscc",
          title: "员工姓名",
          width: 200,
          fixed: "left",
          showOverflow: true,
        },
        { field: "certNum", title: "员工联系方式", width: 200 },
        { field: "registerAddr", title: "行业类型", width: 200 },
        { field: "registerAddr2", title: "细分市场", width: 200 },
        { field: "part1", title: "管控部门", width: 200 },
        { field: "part2", title: "管控部门", width: 200 },
        { field: "part3", title: "组织名称", width: 200 },
        { field: "part4", title: "部门名称", width: 200 },
      ],
      auditIdTableData: [
        {
          custId: 10001,
          orgUscc: "91510104MA6CTA5U1C",
          registerAddr: "中国公司-成都市翡泓文化传播有限公司",
          registerAddr2: "北京",
          part1: "400000228030",
          part2: "成都市锦江区锦华馆街16号5楼2号",
          part3: "400000228030",
          part4: "成都市锦江区锦华馆街16号5楼2号",
        },
        {
          custId: 10002,
          orgUscc: "91510104MA6CTA5U1C",
          registerAddr: "中国公司-成都市翡泓文化传播有限公司",
          registerAddr2: "北京",
          part1: "400000228030",
          part2: "成都市锦江区锦华馆街16号5楼2号",
          part3: "400000228030",
          part4: "成都市锦江区锦华馆街16号5楼2号",
        },
      ],
      auditIdTableLoading: false,
      auditIdTablePage: {
        pageIndex: 1,
        pageSize: 5,
        rowCoun: 0,
      },
      toUploadAttachmentCustId: "",
      // 客户列表-证件照补传-照片预览
      copyIdPhotoeforeAvatarDialogVisible: false,
      // 客户列表-证件照补传-放大图片-弹窗里的图片路径
      copyIdPhotoeforeAvatarDialogImageUrl: "",
      //
      copyIdPhotoList: [],
      copyIdPhotoIsPartyId: "",
      // 自动上传先后台传递的参数
      copyIdPhotoHandleAvatarData: {
        partyId: "",
        fileFlag: "partySup",
        oldPhotoPath: "",
        extPartyId:''
      },
      // 改名改证件
      changeNamephoData: {
        partyId: "",
        fileFlag: "party",
        oldPhotoPath: "",
      },
      innerVisible: false, //明细弹窗
      detailData: [], //明细数据列表
      dtablePage: {
        pageIndex: 1,
        pageSize: 5,
        rowCount: 0,
        pageCount: 0,
      },
      whichComp: Compliance,
      changeNameTitle: "",
      shRow:'',//送审核所需数据
      rowDetail:{},//查看详情所需要的信息
      partyCertId:''
    };
  },
  components: {
    MorePanel,
    DicCustomerSelect,
    DicTable,
    DicCustomerBtnDrawer,
    ChangeName,
    Compliance,
    NewKeyPerson,
    TextDialogModel,
    InputDrawer,
    inputDialogA,
    auditorDialog,
  },
  beforeCreate() {},
  created() {
    // this.resetForm();
  },
  computed: {
    ...mapState("user", ["user"]),
  },
  mounted() {
    this.getCustList();
    this.initValue();
  },
  methods: {
     // 创建一个防反跳策略函数，调用频率间隔 500 毫秒
    searchEvent: XEUtils.debounce(function () {
      this.handleSearch()
    }, 500, {trailing: true }),
    // 行业类型查询事件
    handleSearch () {
      let filterName = XEUtils.toValueString(this.filterName).trim()
      if (filterName) {
        let options = { children: 'children' }
        let searchProps = ['industryTypeName']
        this.custListindustryTableData = XEUtils.searchTree(this.originData, item => searchProps.some(key => XEUtils.toValueString(item[key]).indexOf(filterName) > -1), options)
        // 搜索之后默认展开所有子节点
        this.$nextTick(() => {
          this.$refs.xTree.setAllTreeExpand(true)
        })
      } else {
        this.custListindustryTableData = this.originData
      }
    },
    // 初始化客户列表  ·
    async getCustList() {
      var _this = this;
      var params = {
        searchFlag: "1",
        custName: this.formData.custName, //客户名称
        custNameType: this.formData.custNameType,
        oldPartyCode: this.formData.oldPartyCode, //客户编码
        oldPartyCodeType: this.formData.oldPartyCodeType,
        regionId: this.formData.regionId, //营销责任地id
        controlType: this.formData.controlType, //管控类型
        industryTypeId: this.formData.industryTypeId, //行业类型
        isRealname: this.formData.custReal, //是否合规
        custManagerId: this.formData.custManagerId, //客户
        custStatusCd: this.formData.custStatusCd, //客户状态
        empeeId: this.user.staffId,
        pageIndex: this.query.pageIndex, //请求多少页
        pageSize: this.query.pageSize, //每页多少条
        desenFlag:1
      };
      const response = await CustomerInfoManageServer.getCustListJson(params);
      if (response.code == 200) {
        let custManagerName;
        if (response.meta.hasOwnProperty("customers")) {
          _this.tableData = response.meta.customers;
          _this.tableData.forEach(function (value) {
            value.createDate =
              _this.isNull(value.createDate).substring(0, 4) +
              "-" +
              _this.isNull(value.createDate).substring(4, 6) +
              "-" +
              _this.isNull(value.createDate).substring(6, 8);
            if (value.custManagerNameB) {
              custManagerName =
                _this.isNull(value.custManagerNameA) + ' ' +
                _this.isNull(value.custManagerNameB);
            } else {
              custManagerName = _this.isNull(value.custManagerNameA);
            }
            value.custManagerName = custManagerName;
          });
        } else {
          _this.tableData = [];
          this.query.pageIndex = 1;
          this.query.pageSize = 5;
        }
        //总条数
        this.query.rowCount = Number(response.meta.pageInfo.rowCount);
        this.query.pageCount = Number(response.meta.pageInfo.pageCount);
      } else {
        this.$notify.error({
          title: "错误",
          message: response.msg,
        });
      }
    },
    // 直管类型初始化
    async initValue() {
      let response = "";
      this.selectInfo.forEach(async (item, index) => {
        response = await CustomerInfoManageServer.initValue({
          flag: item.flag,
        });
        if (response.code == 200) {
          this.selectInfo[index].val = response.meta.customers;
        } else {
          this.$notify.error({
            title: "错误",
            message: response.msg,
          });
        }
      });
    },
    // 点击改名改证件执行的方法
    changeNameHandel(row, flag) {
      if (flag == "changeName") {
        (this.changeNameForm.flag = "changeName"),
          (this.changeNameTitle = "改名改证件");
        this.checkCustAudit(row, flag);
      } else {
        (this.changeNameForm.flag = "compliance"),
          (this.changeNameTitle = "合规性认证");
        this.checkCustAudit(row, flag);
      }
      this.changeNameForm.statusCd = row.statusCd;
      this.changeNameForm.partyId = row.partyId;
      this.changeNameForm.custId = row.custId;
      this.changeNameForm.oldPartyCode = row.oldPartyCode;
      this.changeNameForm.regionId = row.regionId;
    },

    // 客户是否在审核中服务权限
    async checkCustAudit(row, flag) {
      let params = {
        custId: row.custId,
        custAuditKind: "2",
      };
      let result = await CustomerInfoManageServer.checkCustAudit(params);
      let res = result.meta;
      if (result.code == 200) {
        // 0 代表不在审核中
        if (res.COUNT != 0) {
          this.isShow = false;
          this.$alert("客户已在审核中，不能进行客户合规性验证操作！", "警告", {
            type: "warning",
            confirmButtonText: "关闭",
          });
        } else {
          this.isShow = true;
        }
      } else {
        this.$notify.error({
          title: "错误",
          message: response.msg,
        });
      }
    },
    handleAvatarSuccess(res, file) {
      this.imageUrl = URL.createObjectURL(file.raw);
    },
    beforeAvatarUpload(file) {
      const isJPG = file.type === "image/jpeg";
      const isLt2M = file.size / 1024 / 1024 < 2;

      if (!isJPG) {
        this.$message.error("上传头像图片只能是 JPG 格式!");
      }
      if (!isLt2M) {
        this.$message.error("上传头像图片大小不能超过 2MB!");
      }
      return isJPG && isLt2M;
    },

    custRealCahnge(val) {
      
    },
    // 行业类型初始化
    industryCdAjax() {
      // 客户树行业类型
      this.filterName = ''
      this.getCustTreeList();
    },
    //获取客户树list
    async getCustTreeList() {
      const response = await CustomerInfoManageServer.getIndustryType();
      if (response.code == 200) {
        this.custListindustryTableData = response.meta;
        this.originData = response.meta
      } else {
        this.$notify.error({
          title: "错误",
          message: response.msg,
        });
      }
    },
    // 营销责任地点击事件
    commonRegionHandel() {
      this.commonRegionNameTablePage.pageIndex = 1;
      this.commonRegionNameTablePage.pageSize = 5;
      // 营销责任地ajax
      this.commonRegionAjax();
    },
    // 营销责任地ajax
    async commonRegionAjax() {
      const response = await CustomerInfoManageServer.getCommonRegionList({
        COMMON_REGION_ID: this.commonRegionNameForm.identityRegion,
        REGION_NAME: this.commonRegionNameForm.regionName,
        pageIndex: this.commonRegionNameTablePage.pageIndex, //请求多少页
        pageSize: this.commonRegionNameTablePage.pageSize, //每页多少条
      });
      if (response.code == 200) {
        if (response.meta.hasOwnProperty("customers")) {
          this.commonRegionNameTableData = response.meta.customers;
        } else {
          this.commonRegionNameTableData = [];
          this.commonRegionNameTablePage.pageIndex = Number(
            response.meta.pageInfo.pageIndex
          );
          this.commonRegionNameTablePage.pageSize = Number(
            response.meta.pageInfo.pageSize
          );
        }
        this.commonRegionNameTablePage.rowCount = Number(
          response.meta.pageInfo.rowCount
        );
        this.commonRegionNameTablePage.pageCount = Number(
          response.meta.pageInfo.pageCount
        );
      } else {
        this.$notify.error({
          title: "错误",
          message: response.msg,
        });
      }
    },
    // 营销责任地查询
    commonRegionQuery() {
      this.commonRegionAjax();
    },
    // 政企客户身份证列表点击
    partyNumberInfo() {
      
    },
    // 分页获取每页多少条
    custManagerHandleSizeChange(val) {
      this.querycustManagerDialog.pageSize = val;
      this.custManagerAjax();
    },
    // 客户经理分页获取当前页
    custManagerHandleCurrentChange(val) {
      
      this.querycustManagerDialog.pageIndex = val;
      this.custManagerAjax();
    },
    // 客户编码下拉框val
    oldPartyCodeTypeChange(val) {
      this.formData.oldPartyCodeType = val;
    },
    // //重置表单
    emptyData(){
     this.formData = {
        // 客户编码
        oldPartyCode: "",
        // 营销责任地id
        regionId: "",
        // 营销责任地名称
        commonRegionName: "",
        // 客户编码-默认展示的值
        oldPartyCodeType: "1",
        //直管类型
        controlType: "",
        // 行业类型
        industryTypeId: "",
        // 行业类型code
        industryName: "",
        // 是否合规
        custReal: "",
        // 客户名称
        custName: "",
        // 客户名称的默认选中的value
        custNameType: "1",
        // 客户经理
        custManagerId: "",
        // 客户经理名称
        custManager: "",
        // 客户状态
        custStatus: [
          {
            value: "",
            label: "请选择",
          },
          {
            value: "1",
            label: "有效",
          },
          {
            value: "2",
            label: "未生效-未送审",
          },
          {
            value: "3",
            label: "未生效-审核中",
          },
          {
            value: "4",
            label: "未生效-审核不通过",
          },
        ],
        // 是否合规
        custRealArr: [
          {
            value: "",
            label: "请选择",
          },
          {
            value: "1",
            label: "是",
          },
          {
            value: "0",
            label: "否",
          },
        ],
        // 客户状态选中的值
        custStatusCd: "",
        // 客户名称与身份证是否一致
        isCardConsistent: "1",
      }
    },
    queryMethods() {
      // 查询
      this.getCustList();
    },
    //重置表单
    emptyData(){
     this.formData = {
        // 客户编码
        oldPartyCode: "",
        // 营销责任地id
        regionId: "",
        // 营销责任地名称
        commonRegionName: "",
        // 客户编码-默认展示的值
        oldPartyCodeType: "1",
        //直管类型
        controlType: "",
        // 行业类型
        industryTypeId: "",
        // 行业类型code
        industryName: "",
        // 是否合规
        custReal: "",
        // 客户名称
        custName: "",
        // 客户名称的默认选中的value
        custNameType: "1",
        // 客户经理
        custManagerId: "",
        // 客户经理名称
        custManager: "",
        // 客户状态
        custStatus: [
          {
            value: "",
            label: "请选择",
          },
          {
            value: "1",
            label: "有效",
          },
          {
            value: "2",
            label: "未生效-未送审",
          },
          {
            value: "3",
            label: "未生效-审核中",
          },
          {
            value: "4",
            label: "未生效-审核不通过",
          },
        ],
        // 是否合规
        custRealArr: [
          {
            value: "",
            label: "请选择",
          },
          {
            value: "1",
            label: "是",
          },
          {
            value: "0",
            label: "否",
          },
        ],
        // 客户状态选中的值
        custStatusCd: "",
        // 客户名称与身份证是否一致
        isCardConsistent: "1",
      }
    },
    //直管类型下拉框
    controlTypeChange() {
      
    },
    // 客户名称查询
    custNameChange(val) {
      
      this.custNameType = val;
      // 1代表青精确 2代表模糊
    },
    // 客户状态
    custStatusChange(val) {
      
      
      this.formData.custStatusCd = val;
    },

    // 营销责任地弹窗分页
    commonRegionNameHandlePageChange(val) {
      
      

      this.commonRegionNameTablePage.pageIndex = val.currentPage;
      this.commonRegionNameTablePage.pageSize = val.pageSize;
      this.commonRegionAjax();
    },
    //  营销责任地获取点击当前行的数据
    commonRegionNameCurrentChangeEvent(val) {
      this.formData.regionId = val.data[val.$rowIndex].COMMON_REGION_ID;
      this.formData.commonRegionName = val.data[val.$rowIndex].REGION_NAME;
      this.$refs.commonRegionNameRef.drawer = false;
    },
    // 客户经理点击事件
    custManagerHandel() {
      this.$nextTick(() => {
        this.$refs.custManagerFormRef.resetFields();
      });
      this.querycustManagerDialog.pageIndex = 1;
      this.querycustManagerDialog.pageSize = 5;
      this.custManagerAjax();
    },
    // 客户经理初始化方法
    async custManagerAjax() {
      const response = await CustomerInfoManageServer.getManagerList({
        STAFF_CODE: this.custManagerForm.STAFF_CODE,
        ORG_NAME: this.custManagerForm.ORG_NAME,
        STAFF_NAME: this.custManagerForm.STAFF_NAME,
        ORG_ID:this.user.orgId,
        pageIndex: this.querycustManagerDialog.pageIndex, //请求多少页
        pageSize: this.querycustManagerDialog.pageSize, //每页多少条
      });
      if (response.code == 200) {
        if (response.meta.hasOwnProperty("customers")) {
          this.custManagerTable = response.meta.customers;
        } else {
          this.custManagerTable = [];
        }

        this.querycustManagerDialog.pageCount =
          response.meta.pageInfo.pageCount;
        this.querycustManagerDialog.rowCount = response.meta.pageInfo.rowCount;
      } else {
        this.$notify.error({
          title: "错误",
          message: response.msg,
        });
      }
    },
    // 客户经理查询方法
    queryCustManagerId() {
      this.custManagerAjax();
    },
    // 客户经理点击表格事件
    custManagerDialogRow(val) {
      this.$nextTick(() => {
        this.$refs.custManagerFormRef.resetFields();
      });

      this.formData.custManager = val.STAFF_NAME;
      (this.formData.custManagerId = val.STAFF_ID),
        (this.$refs.custManagerRef.drawer = false);
    },

    resetForm() {
      this.$nextTick(() => {
        this.$refs.custManagerFormRef.resetFields();
      });
    },
    // 客户列表分页
    handlePageChange(val) {
      this.query.pageIndex = val.currentPage;
      this.query.pageSize = val.pageSize;
      this.getCustList();
    },
    custAuditHistoryHandel(row) {
      this.custAuditHistoryIsShow = true;
      this.customerAuditCiustId = row.custId;
      this.getCustAuditList();
    },
    // 审核历史
    async getCustAuditList() {
      let params = {
        custId: this.customerAuditCiustId,
        pageIndex: this.customerAuditTablePage.pageIndex,
        pageSize: this.customerAuditTablePage.pageSize,
      };
      const response = await CustomerInfoManageServer.getCustAuditList(params);
      
      let res = response.meta;
      if (response.code == 200) {
        if (response.meta.custAuditList) {
          this.customerAuditRecordData = res.custAuditList;
          if (this.customerAuditRecordData) {
            this.customerAuditRecordData.forEach((item) => {
              item.auditStatus = item.auditStatus == 1 ? "同意" : "不同意";
              item.auditDate =
                item.auditDate.substring(0, 4) +
                "-" +
                item.auditDate.substring(4, 6) +
                "-" +
                item.auditDate.substring(6, 8) +
                " " +
                item.auditDate.substring(8, 10) +
                ":" +
                item.auditDate.substring(10, 12) +
                ":" +
                item.auditDate.substring(12, 14);
            });
          }
        } else {
          this.customerAuditRecordData = [];
          this.customerAuditTablePage.pageIndex = Number(
            res.pageInfo.pageIndex
          );
          this.customerAuditTablePage.pageSize = Number(res.pageInfo.pageSize);
        }
        this.customerAuditTablePage.rowCount = Number(res.pageInfo.rowCount);
        this.customerAuditTablePage.pageCount = Number(res.pageInfo.pageCount);
      } else {
        this.$notify.error({
          title: "错误",
          message: response.msg,
        });
      }
    },
    // 客户审核历史分页方法
    customerAuditHandlePageChange(val) {
      this.customerAuditTablePage.pageIndex = val.currentPage;
      this.customerAuditTablePage.pageSize = val.pageSize;
      this.getCustAuditList();
    },
    // 操作日志点击方法
    async operationLogHandel(row) {
      this.opretionIsShow = true;
      this.operationLogRowCustId = row.custId;
      this.operationLogTablePage.pageIndex = 1;
      this.operationLogList();
    },
    // 操作日志
    async operationLogList() {
      let params = {
        custId: this.operationLogRowCustId,
        pageIndex: this.operationLogTablePage.pageIndex,
        pageSize: this.operationLogTablePage.pageSize,
      };
      const response = await CustomerInfoManageServer.getCustLogList(params);
      let res = response.meta;
      if (response.code == 200) {
        if (res.custLogList) {
          this.operationLogData = res.custLogList;
          this.operationLogTablePage.rowCount = Number(res.pageInfo.rowCount);
          this.operationLogData.forEach((item) => {
            item.operationDate =
              item.operationDate.substring(0, 4) +
              "-" +
              item.operationDate.substring(4, 6) +
              "-" +
              item.operationDate.substring(6, 8) +
              " " +
              item.operationDate.substring(8, 10) +
              ":" +
              item.operationDate.substring(10, 12) +
              ":" +
              item.operationDate.substring(12, 14);
          });
        }
      }
      // 总条数
    },
    // 操作日志分页方法
    operationLogHandlePageChange(val) {
      this.operationLogTablePage.pageIndex = val.currentPage;
      this.operationLogTablePage.pageSize = val.pageSize;
      this.operationLogList();
    },

    //证件详情ajax加载
    async cardDetailHandel(row) {
      this.rowDetail = row;
      const result = await CustomerInfoManageServer.getDesensPriv({sysUserId:this.user.sysUserId})
      if(result.code == 200){
         if(result.meta.NUM_COUNT != 0){
           this.dataArr[0][0].sysUser = true;
           this.dataArr[0][2].sysUser = true;
         }
      }
      this.cardDetailInfo(row.partyId);
    },
    // 客户列表-查看-证件详情
    async cardDetailInfo(partyId) {
      
      
      let params = {
        partyId,
        desenFlag:1
      };
      const response = await CustomerInfoManageServer.initGetPartyNews(params);
      
      if (response.code == 200) {
        let result = response.meta;
        this.partyCertId = this.isNull(result.party.partyCert.partyCertId);
        this.getPhoto(result.party.partyCert.photoPath)
        
        this.name = this.isNull(result.party.partyName);
        // 统一社会信用代码
        this.dataArr[0][0].value = this.isNull(result.party.partyCert.orgUscc);
        // 证件类型
        this.dataArr[0][1].value = this.isNull(
          result.party.partyCert.certTypeName
        );
        //  证件号码
        this.dataArr[0][2].value = this.isNull(result.party.partyCert.certNum);
        // 身份证类型
        this.dataArr[0][3].value = this.isNull(result.party.identityTypeName);
        // 身份证编码
        this.dataArr[0][4].value = this.isNull(result.party.partyNbr);
        // 身份证有效期
        this.dataArr[0][5].value = this.isNull(result.party.idExpDate) != '' ? result.party.idExpDate.substring(0, 4) +
            "-" +
            result.party.idExpDate.substring(4, 6) +
            "-" +
            result.party.idExpDate.substring(6, 8) : '';
        // 客户简称
        this.dataArr[0][6].value = this.isNull(result.party.partyAbbrname);
        // 机构类型
        this.dataArr[0][7].value = this.isNull(
          result.party.partyOrg.orgPropertyName
        );
        // 行业类型
        this.dataArr[0][8].value = this.isNull(
          result.party.partyOrg.industryName
        );
        // 登记管理部门名称
        this.dataArr[0][9].value = this.isNull(
          result.party.partyOrg.registerOrg
        );
        // 经济类型
        this.dataArr[0][10].value = this.isNull(
          result.party.partyOrg.econTypeName
        );
        //法定代表人姓名
        this.dataArr[0][11].value = this.isNull(
          result.party.partyOrg.legalRepr
        );
        //注册资本
        this.dataArr[0][12].value = this.isNull(
          result.party.partyOrg.orgAssets
        );
        //成立日期
        this.dataArr[0][13].value = this.isNull(result.party.partyOrg.custBuildDate) != '' ? result.party.partyOrg.custBuildDate.substring(0, 4) +
            "-" +
            result.party.partyOrg.custBuildDate.substring(4, 6) +
            "-" +
            result.party.partyOrg.custBuildDate.substring(6, 8) : '';
        //发照日期
        this.dataArr[0][14].value = this.isNull(result.party.partyCert.issuedate) != '' ?  result.party.partyCert.issuedate.substring(0, 4) +
            "-" +
            result.party.partyCert.issuedate.substring(4, 6) +
            "-" +
            result.party.partyCert.issuedate.substring(4, 6) : '';
        //经营状
        this.dataArr[0][15].value = this.isNull(
          result.party.partyOrg.busiStatusCdName
        );
        //发证机关
        this.dataArr[0][16].value = this.isNull(result.party.partyOrg.certorg);
        //生产经营地址
        this.dataArr[0][17].value = this.isNull(result.party.partyOrg.orgAddr);
        //注册地址
        this.dataArr[1][0].value = this.isNull(
          result.party.partyOrg.registerAddr
        );
        //经营范围
        this.dataArr[2][0].value = this.isNull(result.party.partyOrg.busiScope);
      } else {
        this.$notify.error({
          title: "错误",
          message: response.msg,
        });
      }
    },
    async getPhoto(path){
      if(path){
        const response = await CustomerInfoManageServer.getCustPhoto({photoPath:path});
        if(response.code == 200){
           this.src = response.meta.base64
           this.srcList.push(response.meta.base64)
        }
      }else {
        this.src = '';
        this.srcList = []
      }
    },
    //证件详情 查看
    async partyNumberInfoToView(item, index) {
      let parmas;
      if(item == 1){
          parmas = {
           flag:'orgUscc',
           custId:this.rowDetail.custId,
           partyCertId:this.partyCertId,
           partyId:this.rowDetail.partyId,
           staffName:this.user.staffName,
           staffCode:this.user.staffCode,
         }  
      }else {
         parmas = {
           flag:'certNum',
           custId:this.rowDetail.custId,
           partyCertId:this.partyCertId,
           partyId:this.rowDetail.partyId,
           staffName:this.user.staffName,
           staffCode:this.user.staffCode,
         } 
      }
      const response = await CustomerInfoManageServer.getDesensAttr(parmas);
      if(response.code == 200){
        if(item == 1){
            this.dataArr[0][0].value = response.meta.resultValue;
            this.dataArr[0][0].sysUser = false;
        }else {
            this.dataArr[0][2].value = response.meta.resultValue;
            this.dataArr[0][2].sysUser = false;
        }
      }
    },

    // 判断值是否存在
    isNull(val) {
      if (
        val == "NaN" ||
        val == "null" ||
        val == "undefined" ||
        val == undefined
      ) {
        return (val = "");
      } else {
        return val;
      }
    },
    format(val) {
      var time = new Date(parseInt(val));
      var y = time.getFullYear();
      var m = time.getMonth() + 1;
      var d = time.getDate();
      return y + "-" + this.add0(m) + "-" + this.add0(d);
    },
    add0(m) {
      return m < 10 ? "0" + m : m;
    },

    // 客户列表-行业类型
    custListCellDBLClickEvent(data) {
      this.$refs.industyRef.drawer = false;
      this.formData.industryTypeId = data.row.industryTypeCode;
      // 获取行业类型的code
      this.formData.industryName = data.row.industryTypeName;
    },
    // 上传附件-弹窗显示-点击事件
    toUploadAttachmentsHandel(row) {
      this.toUploadAttachmentCustId = row.custId;
      // 
      this.toUploadAttachmentIsShow = true;
      this.toUploadTablePage.pageIndex = 1;
      this.toUploadTablePage.pageSize = 5;
      this.initUploadAttacList(this.toUploadAttachmentCustId);
    },
    // 附件上传 -- c初始化列表 初始化 ajax
    async initUploadAttacList(custId) {
      let params = {
        custId: custId,
        pageIndex: this.toUploadTablePage.pageIndex,
        pageSize: this.toUploadTablePage.pageSize,
      };
      const response = await CustomerInfoManageServer.getCustFileList(params);
      if (response.code == 200) {
        if (response.meta.executeSqlResp) {
          this.toUploadTableData = response.meta.executeSqlResp;
        } else {
          this.toUploadTableData = [];
          this.toUploadTablePage.pageIndex = Number(
            response.meta.pageInfo.pageIndex
          );
          this.toUploadTablePage.pageSize = Number(
            response.meta.pageInfo.pageSize
          );
        }
        this.toUploadTablePage.pageCount = Number(
          response.meta.pageInfo.pageCount
        );
        this.toUploadTablePage.rowCount = Number(
          response.meta.pageInfo.rowCount
        );
      } else {
        this.$notify.error({
          title: "错误",
          message: response.msg,
        });
      }
    },
    // 附件上传 -- 默认加载 初始化 ajax
    toUploadAttachmentSubmitChangeForm(row) {
      this.toUploadAttachmentIsShow = false;
    },

    // 上传附件表格分页
    toUploadhandlePageChange(val) {
      this.toUploadTablePage.pageIndex = val.currentPage;
      this.toUploadTablePage.pageSize = val.pageSize;
      this.initUploadAttacList(this.toUploadAttachmentCustId);
    },

    // 客户列表-下载-点击方法
    downloadHandel(row) {
      this.downFiles(row);
    },
     // 客户列表-删除
    async delateHandel(row){
      let params = {
              accId: row.accId,
              custId: row.custId,
            };
          const res = await CustomerInfoManageServer.delCustFile(params);
          this.toUploadTablePage.pageIndex = 1;
          this.toUploadTablePage.pageSize = 5;
          this.initUploadAttacList(this.toUploadAttachmentCustId);
          },
    // 上传附件-下载-ajax
    async downFiles(row) {
      let params = {
        urlAddress: row.urlAddress,
        accName: row.accName,
      };
      const res = await CustomerInfoManageServer.getCustFile(params);
      if (res.size > 0) {
        let url = window.URL.createObjectURL(new Blob([res])); //创建下载链接
        let link = document.createElement("a"); //创建a标签
        link.style.display = "none"; //将a标签隐藏
        link.href = url; //给a标签添加下载链接
        link.setAttribute("download", row.accName); // 此处注意，要给a标签添加一个download属性，属性值就是文件名称 否则下载出来的文件是没有属性的，空白白
        document.body.appendChild(link);
        link.click(); //执行a标签
      } else {
        this.$confirm(row.accName + "下载失败!", "提示", {
          confirmButtonText: "确定",
          showCancelButton: false,
          type: "warn",
          center: true,
        });
      }
    },
    // 客户列表上传附件ajax
    async custListUploadHttp(param) {
      var that = this;
      //判断上传文件数量
      if (this.custListfileList.length == 0) {
        that.$message({
          message: "请选择导入的文件",
          type: "warning",
          duration: "2000",
        });
      } else {
        //创建FormData();主要用于发送表单数据
        let paramFormData = new FormData();
        var files = param.file;
        paramFormData.append("file", files);
        paramFormData.append("fileFlag", "cust");
        paramFormData.append("custId", this.toUploadAttachmentCustId);
        paramFormData.append("createBy", this.user.staffId);
        paramFormData.append("accType", "98410001");

        const response = await CustomerInfoManageServer.saveCustFile(
          paramFormData
        );
        if (response.code == 200) {
          
          if(response.meta.resultCode == 0){
            this.$notify({
              title: '成功',
              message: '图片上传成功',
              type: 'success'
            });
            this.toUploadTablePage.pageIndex = 1;
            this.toUploadTablePage.pageSize = 5;
            this.initUploadAttacList(that.toUploadAttachmentCustId);
            this.$refs.custuploadRef.clearFiles();
          }
        } else {
          this.$notify.error({
            title: "错误",
            message: response.msg,
          });
        }
      }
    },
    // 客户列表-上传附件-文件类型
    custListfileBeforeAvatarUpload(file) {
      let fileType = file.name.split(".").pop().toLowerCase();
      const isLt10M = file.size / 1024 / 1024 < 10;
      if ("bat" == fileType || "dll" == fileType || "zip" == fileType || "exe" == fileType) {
        this.$alert(
          "文件上传失败！上传文件的文件不能包含bat、dll、zip、exe类型！",
          "警告",
          {
            type: "warning",
            confirmButtonText: "关闭",
          }
        );
        return false;
      }
      if (!isLt10M) {
        this.$alert("上传文件大小不能超过 10MB!", "警告", {
          type: "warning",
          confirmButtonText: "关闭",
        });
        return false;
      }
    },
    // 客户列表-上传文件
    custListonChange(file, fileList) {
      this.custListfileList = fileList;
    },

    // 文件超出个数限制时的钩子
    custListHandleExceed(files, fileList) {
      this.$message.warning(`当前限制选择 1 个文件`);
    },

    // 删除文件
    custListHandleRemove(file, fileList) {
      this.custListfileList = fileList;
    },

    // 客户列表上传附件-提交
    custListSubmitUpload() {
      this.$refs.custuploadRef.submit();
    },
    // 客户列表-编辑-权限设置
    copyIdPhotosHandel(row) {
      if (row.identityType != "" && row.identityType != undefined) {
        this.copyIdPhotoIsShow = true;

        // 接收partyId
        this.copyIdPhotoHandleAvatarData.partyId = row.partyId;
        this.copyfillPhotoInit(row.partyId);
      } else {
        this.$alert(
          "该客户未进行实名认证,不能进行客户证件照补传操作！",
          "警告",
          {
            type: "warning",
            confirmButtonText: "关闭",
          }
        );
      }
    },
    //  证件照补传-初始化接口
    async copyfillPhotoInit(partyId) {
      let params = {
        partyId,
      };
      const response = await CustomerInfoManageServer.initGetPartyNews(params);
      var res = response.meta.party;
      // 客户名称
      this.copyIdPhoto.partyName = this.isNull(res.partyName);
      // 证件类型
      this.copyIdPhoto.certTypeName = this.isNull(res.partyCert.certTypeName);
      //  证件号码
      this.copyIdPhoto.certNum = this.isNull(res.partyCert.certNum);
      //  证件号码
      this.copyIdPhoto.certAddr = this.isNull(res.partyCert.certAddr);
      this.copyIdPhoto.photoName = this.isNull(res.partyCert.photoName);
      this.copyIdPhoto.photoPath = this.isNull(res.partyCert.photoPath);
      this.copyIdPhotoHandleAvatarData.extPartyId = this.isNull(res.extPartyId);

      if (
        this.isNull(this.copyIdPhoto.photoPath) &&
        this.isNull(this.copyIdPhoto.photoName)
      ) {
        // 进行照片的上传
        // 将老的值保存一份
        this.copyIdPhotoHandleAvatarData.oldPhotoPath =
          this.copyIdPhoto.photoPath;
        this.getCustPhoto(
          this.copyIdPhoto.photoName,
          this.copyIdPhoto.photoPath
        );
      } else {
        this.copyIdPhotoList = [];
      }
    },

    // 附件上传-证件照回显
    async getCustPhoto(photoName, photoPath) {
      
      let params = {
        photoPath,
      };
      const response = await CustomerInfoManageServer.getCustPhoto(params);
      this.copyIdPhotoList = [
        {
          name: photoName,
          url: response.meta.base64,
        },
      ];
    },
    // 证件复印件照片-on-success
    copyIdPhotoeforeAvatarUpload(file) {
      
      const isJPG = true;
      // const isJPG = file.type === 'image/jpeg';
      const isLt10M = file.size / 1024 / 1024 < 10;

      if (!isJPG) {
        this.$message.error("上传头像图片只能是 JPG png格式!");
      }
      if (!isLt10M) {
        this.$message.error("上传图片大小不能超过 10MB!");
      }
      return isJPG && isLt10M;
    },

    // 证件复印件照片-before-success
    copyIdPhotoHandleAvatarSuccess(res, file) {
      var _this = this;
      this.copyIdPhotoHandleAvatarData.oldPhotoPath = res.meta.photoPath;
      if (res.code == 200) {
        this.$notify({
          title: "成功",
          message: "图片上传成功",
          type: "success",
        });
      }
    },
    //
    copyIdPhotoHandleAvatarChange(file, fileList) {
      var returnArr;
      if (fileList.length > 1) {
        returnArr == fileList.shift();
        
      }
      this.copyIdPhotoList = fileList;
      
      // 
    },
    // 预览照片时调用的方法
    copyIdPhotoHandleAvatarPreview(file) {
      this.copyIdPhotoeforeAvatarDialogImageUrl = file.url;
      this.copyIdPhotoeforeAvatarDialogVisible = true;
    },

    // 跳转到修改客户基本信息
    pathToView(row, path, queryParams) {
      if (row.identityType != "" && row.identityType != undefined) {
        this.$router.push({
          path: path,
          query: queryParams,
        });
      } else {
        if(path == '/modifyBasicInfo'){
           this.$alert(
            "该客户未进行实名认证,不能进行客户基本信息修改操作！",
            "警告",
            {
              type: "warning",
              confirmButtonText: "关闭",
            }
          );
        }else if(path == '/custContactInfo'){
          this.$alert(
            "该客户未进行实名认证,不能进行客户联系人信息操作！",
            "警告",
            {
              type: "warning",
              confirmButtonText: "关闭",
            }
          );
        }else if(path == '/custCutoverInfo'){
          this.$alert(
            "该客户未进行实名认证,不能进行客户割接通知信息操作！",
            "警告",
            {
              type: "warning",
              confirmButtonText: "关闭",
            }
          );
        }
        
      }
    },
    // 客户证件照补传-确定
    copyIdPhotoSubmitChangeForm(row) {
      
    },
    // 客户列表-当选择未审核-未送审时-送审核显示
    customerReviewHandel(row) {
      this.auditIdComponentsIsShow = true;
    },
    customerReviewSubmitChangeForm(row) {
      this.customerReviewIsShow = false;
      this.auditIdComponentsIsShow = false;
    },
    // 审核人选择确定之后-回显的审核人id值方法
    async sunmitAuditIdHandel(val) {
      let parmas = {
        staffId: this.user.staffId,
        custId: this.shRow.custId,
        auditor:val[0]
      };
      const response = await CustomerInfoManageServer.sendCustAudit(parmas);
      if (response.code == 200) {
        if(response.meta.resultCode == 0){
          this.customerReviewIsShow = false;
          this.auditIdComponentsIsShow = false;
          this.getCustList();
        }else {
          this.$message({
            showClose: true,
            message: response.meta.resultMsg,
            type: 'error'
          });
        }
      }
    },
    // 关闭审核人弹窗
    modifyTaxpayerCloseDialog() {
      this.auditIdComponentsIsShow = false;
      this.auditIdComponentsIsShow = false;
    },
    // 删除客户
    delateCusthandel(row) {
      this.$confirm("确认删除该客户关系？", "提示", {
        confirmButtonText: "确定",
        type: "warning",
        cancelButtonText: "取消",
      })
        .then(async () => {
          let parmas = {
            partyId: row.partyId,
            custId: row.custId,
          };
          const response = await CustomerInfoManageServer.deleteCust(parmas);
          if (response.code == 200) {
            // this.detailData = response.meta.executeSqlResp;
            if(response.meta.resultCode == 0){
                this.getCustList()
            }else {
              this.$message({
                showClose: true,
                message: response.meta.resultMsg,
                type: 'error'
              });
            }
          }
        })
        .catch(() => {});
      
    },
    // 客户列表-未送审-未审核时的审核人弹窗中-表格的点击事件
    auditIdCurrentChangeEvent(rowData) {
      
    },
    // 客户列表-未送审-未审核时的审核人弹窗中-表格的-分页
    auditIdHandlePageChange(val) {
      
      
    },
    detailDialog(val) {
      
      this.innerVisible = true;
      if (val.operationCd == "editNews") {
        this.getUpdateNewsLog(val);
      } else if (val.operationCd == "edit") {
        this.queryUpdateModLog(val);
      } else if (val.operationCd == "editName_s") {
        this.lookChangeName_s(val);
      }
    },
    //客户联系人修改明细
    async getUpdateNewsLog(val) {
      let parmas = {
        custInfoLogId: val.id,
        custId: val.custId,
      };
      const response = await modificationDetails.getUpdateNewsLog(parmas);
      if (response.code == 200) {
        this.detailData = response.meta.executeSqlResp;
      }
    },
    //客户信息修改明细
    async queryUpdateModLog(val) {
      let parmas = {
        custInfoLogId: val.id,
        custId: val.custId,
      };
      const response = await modificationDetails.queryUpdateModLog(parmas);
      if (response.code == 200) {
        this.detailData = response.meta.executeSqlResp;
      }
    },
    //改名改证件修改明细
    async lookChangeName_s(val) {
      let parmas = {
        custInfoLogId: val.id,
        custId: val.custId,
      };
      const response = await modificationDetails.lookChangeName_s(parmas);
      if (response.code == 200) {
        this.detailData = response.meta.executeSqlResp;
      }
    },
    pageChange(val) {
      this.dtablePage.pageIndex = val;
    },
    //点击改名改证件时弹窗关闭-并初始化列表方法
    subitForm() {
      this.isShow = false;
      this.getCustList();
    },
    cancelHandel() {
      this.isShow = false;
    },
    // 送审核弹窗
    sendAuditHandel(row) {
      if(row.auditStatusCd == '1120'){
        this.$alert(
          "该客户已在审核中！",
          "提示",
          {
            type: "warning",
            confirmButtonText: "关闭",
          }
        );
        return
      }
      this.customerReviewIsShow = true;
      this.auditIdComponentsIsShow = true;
      this.shRow = row
    },
  },
};
</script>
<style lang="scss" scoped>
.m-table-box {
  position: relative;
}
.u-tabs-btn {
  text-align: center;
  display: inline-block;
  list-style: none;
  width: 100%;
  height: 0.5rem;
  line-height: 0.5rem;
  background-color: #fbfbfb;
  color: #0052d9;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.15rem;
  cursor: pointer;
  border-radius: 5px;
  border: 1px solid #f0f0f0;
}
.current {
  background-color: #404752;
  color: #f0f0f0;
}
.radio-mt {
  margin-top: 10px;
}
.table {
  margin-top: 20px;
}
.m-pagination {
  margin: 20px auto;
  text-align: center;
}
.name-wrapper {
  display: inline-block;
  width: 30%;
}
.name-wrapper button {
  padding: 0;
}
.el-input.is-disabled .el-input__inner {
  cursor: pointer !important;
}
.commonRegionId-table .el-table__body-wrapper table tbody tr {
  cursor: pointer !important;
}
.flexCol{
  display: flex;
  height: 40px;
  align-items: center;
}
.m-tree-box {
  padding: 0.2rem;
}
.commonRegionId-table {
  margin-top: 20px;
}
.u-tabgs-btn {
  display: inline-block;
  line-height: 0.3rem;
  cursor: pointer;
}
.m-title {
  margin-top: 20px;
  margin-bottom: 20px;
  color: #0052d9;
  font-size: 12px;
}
.m-title .icon {
  float: left;
  display: block;
  width: 4px;
  height: 12px;
  background: #f56f3c;
  margin-top: 2px;
  margin-right: 10px;
  font-size: 14px;
}
.el-drawer__header {
  display: none !important;
}
.el-drawer__title {
  display: none !important;
}
.m-cust-info .u-name {
  color: #666;
  text-align: right;
}
.m-cust-info .u-value {
  color: #999;
}
.m-cust-info .u-info-title {
  font-size: 0.16rem;
  margin: 0 0.1rem;
  margin-bottom: 0.1rem;
  font-weight: bold;
  padding: 0 0 0.15rem 0.15rem;
  color: #666;
  margin-bottom: 0.2rem;
  border-bottom: 2px solid #f6f6f6;
}
.u-toView-btn {
  padding: 0;
}
.u-image {
  height: 3.5rem;
}
.m-table {
  margin-top: 0.2rem;
}
.m-row {
  padding: 0.05rem 0;
}
.avatar-uploader .el-upload {
  border: 1px dashed #d9d9d9;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.avatar-uploader .el-upload:hover {
  border-color: #409eff;
}
.avatar-uploader-icon {
  font-size: 0.28rem;
  color: #8c939d;
  width: 1.78rem;
  height: 1.78rem;
  line-height: 178px;
  text-align: center;
}
.avatar {
  width: 1.78rem;
  height: 1.78rem;
  display: block;
}
.u-select-box {
  width: 100%;
}
.el-form-item {
  padding: 0 0.1rem !important;
}
.el-select {
  width: 100%;
}
.select-box {
  width: 0.8rem;
}
.u-point {
  display: inline-block;
  width: 4px;
  height: 4px;
  background: #666;
  border-radius: 50%;
  float: left;
  margin-top: 0.13rem;
  margin-right: 0.1rem;
}
.exp {
  position: absolute;
  bottom: 8px;
  li {
    margin-right: 0.1rem;
  }
}
.sfz {
  float: left;
  width: 0.15rem;
  height: 0.15rem;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-position: center;
  margin-top: 0.07rem;
  margin-right: 0.05rem;
  &.yhg {
    background-image: url("~@/assets/imgs/order/p_yihegui.png");
  }
  &.whg {
    background-image: url("~@/assets/imgs/order/p_weihegui.png");
  }
  &.dsh {
    background-image: url("~@/assets/imgs/order/p_daihegui.png");
  }
}
.m-table ::v-deep .vxe-body--row .vxe-body--column:nth-child(2) .c--tooltip {
  text-align: left;
}
.mtop {
  margin-top: 0.02rem;
}
// .m-table .vxe-cell--title {
//   text-align: center;
// }
.flex {
  text-align: center;
  // display: inline-block;
}
.u-btn {
  margin-left: 10px;
}
.opt-btn {
  padding: 0 0.05rem;
  cursor: pointer;
}
.opration-add {
  padding: 0 0.15rem;
}
.box-center {
  text-align: center;
}
.img_div a:hover .mask {
  opacity: 1;
}
.mask {
  position: absolute;
  top: 0;
  left: 0;
  width: 360px;
  height: 180px;
  background: rgba(101, 101, 101, 0.6);
  color: #ffffff;
  opacity: 0;
}
.mask-s {
  position: absolute;
  top: 50%;
  left: 40%;
}
.f-s-30 {
  font-size: 30px;
}
.m-l25 {
  margin-left: 25px;
}
.searchType {
  height: 25px;
  width: 200px;
  margin-left: 0.2rem;
}
::v-deep .el-image-viewer__img{
  transform:scale(2)!important;
}
</style>
